import Vue from 'vue'
import * as apis from '../../services/apis'
import * as types from '../mutation-types'
import http from '../../http'

const state = {
  proDetail: {}
}

const getters = {
  proDetail: state => state.proDetail
}

const actions = {
  getProDetail({
    commit
  }, payload) {
    let url = apis.GET_PRO_DETAIL+'/'+payload.proId
    Vue.http.post(url).then((res) => {
      commit(types.GET_PRO_DETAIL, res.body)
    })
  }
}

const mutations = {
  [types.GET_PRO_DETAIL](state, payload) {
    state.proDetail = payload.result
  }
}


export default {
  state,
  getters,
  actions,
  mutations
}
